using B.S.DataBase.MyProject.Domain.SmartHealthcareZSJ;
using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using MedicalPCTerminal.Read.API.Appcation.Commands.HospitalDepartCommand;
using Microsoft.AspNetCore.Mvc;

namespace MedicalPCTerminal.Read.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class HospitalDepartmentController : ControllerBase
    {
        private readonly IMediator mediator;

        public HospitalDepartmentController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 医院科室查询
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<ApiPaging<HospitalDepartmentZ>> HospitalDepartQuery([FromQuery]HospitalDepartQueryCommand request)
        {
            try
            {
                return await mediator.Send(request);
            }
            catch (Exception)
            {

                throw;
            }
        }
    }
} 